<?php 
/**
 * alltosun.com 意见反馈接口
 * ============================================================================
 * 版权所有 (C) 2009-2011 北京互动阳光科技有限公司，并保留所有权利。
 * 网站地址: http://www.alltosun.com
 * ----------------------------------------------------------------------------
 * 许可声明：这是一个开源程序，未经许可不得将本软件的整体或任何部分用于商业用途及再发布。
 * ============================================================================
 * $Author: 高昂 (gaoa@alltosun.com) $
 * $Date: 2016-1-25 下午4:51:13 $
 * $Id: $
 */

class Action
{
    private $token = '';
    private $user_id = 0;
    private $user_info = array();

    public function __construct()
    {
        $this->token    = an_request('token');

        if ($this->token) {
            $user_info = user_helper::get_user_info_by_token($this->token);
            if ($user_info && $user_info['status'] == 1) {
                $this->user_id = $user_info['id'];
                $this->user_info = $user_info;
            }
        }
    }
    
    
    
    public function send_opinion()
    {
        $opinion = an_request('opinion', '');
        $mobile = an_request('mobile', '');
        
        $check_params = array(
                'opinion' => $opinion,
                'mobile'  => $mobile,
                
        );
        
        api_helper::check_sign($check_params, 1);
        
        $res = _widget('opinion')->create($opinion, $mobile);
        
        if ("success" == $res['flag']) {
            api_helper::return_data(0, 'success');
        } else {
            api_helper::return_data(1, $res['info']);
        }
        
    }

}

?>